import React, { useCallback } from 'react'
import { useSelector, useDispatch } from 'react-redux'

export default function Chat() {
  const count = useSelector(state => state.count)
  const dispatch = useDispatch()

  const handleClick = useCallback(
    () => {
      dispatch({
        type: 'mutate-add'
      })
    },
    [dispatch],
  )

  return (
    <div>
      {count}
      <button onClick={handleClick}>add</button>
    </div>
  )
}
